<?php
 mkdir('/var/www/prueba/image', 0777);
 chmod("/var/www/prueba/image", 0777);
?>
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input name="uploadedfile" type="file" />
<input type="submit" name="submit" value="Subir archivo" />
</form> 

<?php
if(isset($_POST['submit']))
{
    $target_path = "/var/www/prueba/image/";
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) 
    { 
            //echo "El archivo ". basename( $_FILES['uploadedfile']['name']). " ha sido subido";
    } else{
        echo "Ha ocurrido un error, trate de nuevo!";
    }
    echo "<br/><center>";
        //echo $_FILES['uploadedfile']['name'];
        echo '<img src="image/'.$_FILES['uploadedfile']['name'].'" >';
    echo "</center>";
}
?>


